<script setup lang="tsx">
import { PropType, reactive } from 'vue'
import type { TableData } from '@/api/parameter/types'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
import { useI18n } from '@/hooks/web/useI18n'
// import { ElTag } from 'element-plus'
import List from './List.vue'
const { t } = useI18n()

defineProps({
  currentRow: {
    type: Object as PropType<Nullable<TableData>>,
    default: () => null
  }
})

const schema = reactive<DescriptionsSchema[]>([
  {
    field: 'parameterName',
    label: t('parameter.parameterName')
  },
  {
    field: 'description',
    label: t('parameter.description')
  },
  {
    field: 'category',
    label: t('parameter.category'),
    slots: {
      default: (data: any) => {
        return <span>{data.category == 0 ? '单值' : '多值'}</span>
      }
    }
  },
  {
    field: 'parameterValue',
    label: t('parameter.parameterValue')
  },
  {
    field: 'createdDate',
    label: t('parameter.createdDate')
  },
  {
    field: 'content',
    label: t('parameter.child'),
    span: 24,
    slots: {
      default: (data: any) => {
        return <List basicsParameterValueList={data.basicsParameterValueList} />
      }
    }
  }
])
</script>

<template>
  <Descriptions :schema="schema" :data="currentRow || {}" />
</template>
